-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: serialize buffer size check #47
Conversation
2bdfd70
to
caf14e2
Compare
caf14e2
to
bb5417a
Compare
During the check that we dont overflow the serialization buffer we erroneously checked with size(uint32_t) == 1 which could cause us to crash with some input strings. Signed-off-by: Michael Hoffmann <[email protected]>
bb5417a
to
8078460
Compare
@amaanq This change doesn't compile with |
Oh sorry! We should add a CI pass for that. What are the flags and the compiler again? I'll see ti fixing it after work today. |
Just |
You could also use the upstream workflow while you're at it: https://github.com/tree-sitter-grammars/template/tree/master/.github/workflows |
Weird, I did run the tests and all multiple times using the tree sitter cli, I wonder why build should break if the compilation for tests worked. |
Which CLI version? |
|
Could be compiler version-specific, of course. (Latest CLI -- and the one we test with -- is 0.22.6.) And you're compiling from the |
TEMPLATE_INTERPOLATION, | ||
TEMPLATE_DIRECTIVE, | ||
QUOTED_TEMPLATE, | ||
HEREDOC_TEMPLATE, | ||
}; | ||
} ContextType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're missing these changes in the terraform scanner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈 that explains it; sorry and thank you! Is there a way to handle the terraform scanner more elegantly? I put it there because at the time nvim-treesitter didnt allow having queries for multiple filetypes with one parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's really the same parser, you can register it for other filetypes with vim.treesitter.language.register()
. But if the queries differ, this is pretty much the only way without manual query loading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Queries differ somewhat ( there used to be only one, but then there were some complaints that some strings got highlighted as terraform keywords in other hcl based languages like for packer or whatnot, so i split it into generic hcl and then terraform iirc )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think this is the best for now (until upstream tree-sitter adds dedicated "dialect" support).
I just pushed a fixup with the missing changes. @amaanq You probably still want to rewrite these scanners. |
During the check that we dont overflow the serialization buffer we erroneously checked with size(uint32_t) == 1 which could cause us to crash with some input strings.
might fix #46